<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>前台与维修登录页</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon"/>
    <link rel="stylesheet" href="lib/layui/css/layui.css">
    <link rel="stylesheet" href="//at.alicdn.com/t/font_693759_ask70l8wanw.css">
    <link rel="stylesheet" href="https://cdn.bootcss.com/animate.css/3.5.2/animate.min.css"/>
    <link rel="stylesheet" href="css/login.css"/>
	<link rel="stylesheet" href="lib/nprogress/nprogress.css">
</head>
<body>
    <div class="login-box animated rotateIn">
        <div class="head"></div>
        <div class="input-box">
            <form class="layui-form" action="">
                <input type="text" name="username" required lay-verify="required" placeholder="员工登录账号" autocomplete="off" class="layui-input">
                <input type="password" name="password" required lay-verify="required" placeholder="密码" autocomplete="off" class="layui-input">
                <div class="remember-me">
                    <span>记住我：</span>
                    <input type="checkbox" name="zzz" lay-skin="switch" lay-text="是|否">
                </div>
                <input type="submit" value="登 录" lay-submit lay-filter="login">
            </form>
            
        </div>
        <div class="copyright">
                         时代的潮流里需要我们不断的探索与前进~
        </div>
    </div>
    <!--js逻辑-->
    <script src="lib/layui/layui.js"></script>
	<script src="lib/nprogress/nprogress.js"></script>
    <script type="text/javascript">
		NProgress.start();
		window.onload = function() {
		    NProgress.done();
		}
        layui.use(['form', 'jquery'], function () {
            var form = layui.form;
            var $ = layui.jquery;
			

            form.on('submit(login)', function (data) {
            	var name = $('input[name=username]').val();
		        var pwd = $('input[name=password]').val(); 
                layer.msg("登陆中...", {icon: 6, time: 1000, anim: 4},
            
            /*
             *layui传递Ajax
             * */
             $.post("http://function.516code.cn/functionPage/function/repairlogin.do",{"username":name,"pwd":pwd},function(res){
                if(res.data.personnelType ==1){
//              	content:'repairPage/indexRepair.html';
                	window.location.href='repairPage/indexRepair.html';
                }else{
                	window.location.href='ReceptionPage/index.html';
                }
             }));
                return false;
            });

             
            
        });
        /*
         ajax传递数据到后台
         * */
        
        /*function check() {
            var name = $("input[name=username]").val();
            var pwd = $("input[name=password]").val();
            if ("" == name || "" == pwd) {
                alert('用户名或者密码不能为空');
            } else {
                $.ajax({
                    type : 'post',
                    url : 'http://localhost:8080/function/repairlogin',
                    dataType:'json',
                    data:{
                    	username:name,
                    	pwd:pwd,
                    },
                    success : function(msg) {
                    	layer.msg("登陆中...", {icon: 6, time: 1000, anim: 4});
                    var ss =msg.data;
                    console.log(ss);
                    }
                });
                  
            }
        }*/
    </script>
</body>
</html>